Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL PR js-iden3-auth: VidosResolver #1

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Conversation

toteto
Copy link
Collaborator

@toteto toteto commented May 13, 2024

This PR is implementing VidosResolver to be used as state resolver for the js-iden3.

Example PR: mailchain/polygonid-tutorial-examples#1

Copy link
Member

@robdefeo robdefeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of suggests to duplicate in both methods

import { Id } from '@iden3/js-iden3-core';
import { type IStateResolver, type ResolvedState, isGenesisStateId } from './resolver';

type DidResolutionResult = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you import import type { DIDResolutionResult } from 'did-resolver'; instead of defining it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done fa1ed4c, needed to extend the type for it to facilitate the Polygon ID state fields.

const stateHex = state.toString(16);

const zeroAddress = '11111111111111111111'; // 1 is 0 in base58
const did = `did:polygonid:polygon:amoy:${zeroAddress}?gist=${stateHex}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about how to make this work on different networks other than Amoy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done cc4047c, added a network param to the VidosResolver constructor.

});
const result = (await response.json()) as DidResolutionResult;

const globalInfo = result.didDocument.verificationMethod[0].global;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest checking for an error in result.didResolutionMetadata.error before going too far as otherwise likely will give an incorrect result

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 7165914, error is thrown on such resolution error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants